﻿<base:BaseNavigationPage 
           x:Class="WebSiteAdminTool.UI.Views.Security.Roles.RoleManagementPage" 
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           xmlns:base="clr-namespace:WebSiteAdminTool.UI.Views.Base"
           xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
           xmlns:behaviors="clr-namespace:WebSiteAdminTool.UI.Utils.Behaviors"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Role Management"
           DataContext="{Binding RoleManagementViewModel, Source={StaticResource ViewModelLocator}}">
    <UserControl.Resources>
        <!--<viewModels:MainViewModel x:Key="MainViewModel"/>-->
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Style="{StaticResource PageLayoutStyle}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0">
            <!--DataContext="{StaticResource MainViewModel}"-->
            <TextBlock Style="{StaticResource PageNotesStyle}">
                <Run>You can optionally add roles, or groups, that enable you to allow or deny groups of users access to specific folders in your Web site. For example, you might create roles such as "managers," "sales," or "members," each with different access to specific folders.</Run>
            </TextBlock>
            <sdk:Label Style="{StaticResource PageSectionHeader}">Existing Roles</sdk:Label>
        </StackPanel>
        <sdk:DataGrid x:Name="RolesDataGrid" Grid.Row="1" Style="{StaticResource ItemsGridStyle}" 
                      ItemsSource="{Binding RolesList}"
                      SelectedItem="{Binding SelectedRole, Mode=TwoWay}" 
                      Margin="10">
            <i:Interaction.Behaviors>
                <behaviors:DataGridDoubleClickBehavior
                            DoubleClickCommand="{Binding DoubleClickCommand}" 
                            CommandParameter="{Binding SelectedItem, ElementName=RolesDataGrid}"/>
            </i:Interaction.Behaviors>
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn Binding="{Binding RoleName}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Role Name" Width="Auto" />
                <sdk:DataGridTextColumn Binding="{Binding UsersInRole}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Users In Role" Width="Auto" />
                <sdk:DataGridTextColumn Binding="{Binding Description}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Description" Width="*" />
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
    </Grid>
</base:BaseNavigationPage>
